home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 August: Tool Chest / Dev.CD Aug 98 TC.toast / Tool Chest / Testing & Debugging / Mac OS Development Toolkit / Automation Essentials 2.3.0 / Host Automation Folder / LaunchQuit Engine / Dev LaunchQuits < prev    next >
Encoding:
Text File  |  1998-03-19  |  12.5 KB  |  335 lines  |  [TEXT/MPS ]

  1. #########################################################################
  2. #########################################################################
  3. ##                     Copyright © Apple Computer, Inc. 1993-1997
  4. ##                                All rights reserved
  5. #########################################################################
  6. #########################################################################
  7. #    
  8. #    Library:        Dev Launchquits
  9. #        
  10. #    Version:        2.1.4
  11. #    Description:    This library is used for developing new Launchquit test
  12. #                    defs. To use it you must make it modifiable. Select the 
  13. #                    text on the line below starting with Commando (not the ##), 
  14. #                    hit the enter key, click 'Files to write enable…', select 
  15. #                    this file in the dialog provided, click the Done button, 
  16. #                    then press enter again. The write protect indicator for
  17. #                    this file (a pencil in the upper left corner of the window)
  18. #                    should have a dotted line through it, or no line, showing
  19. #                    you can now change the file.
  20. #                    
  21. #                    Commando ModifyReadOnly ∑∑ Dev:Null
  22. #    Contains:
  23. #        GetDevLaunchQuitTD()
  24. #        
  25. #    History:
  26. #        Date:        By:        Changes:
  27. #        05/19/93    SBR        Created
  28. #        03/21/94    SBR        Changed to new lookup task, added instructions.
  29. #        07/30/95    SBR        Changes to GetDevLaunchQuitTC.
  30. #        01/30/97    SBR        Deleted older exception code and comments.
  31. #        01/31/97    SBR        Changed from GetDevLaunchQuitTC to GetDevLaunchQuitTD.
  32. #########################################################################
  33. #########################################################################
  34.  
  35. Libraries "Report.lib";
  36.  
  37. ##############################################################################################
  38. #    task    GetDevLaunchQuitTD(v_level)
  39. #=============================================================================================
  40. #    Description:    This task is a substitute test def lookup task for developing Launchquit
  41. #                    test defs. The only service it provides is "nextTD", so if you want to 
  42. #                    execute a subset of the test defs you create you must comment them out 
  43. #                    manually. Add the new test defs by duplicating the sample along with its
  44. #                    Setup line, removing the comment symbol (#) and replacing the old data 
  45. #                    with the new. You can add as many test defs as you want.
  46. #    Parameters:        v_level
  47. #    Returns:        a Launchquit test def
  48. #    Examples:        theTestDef := GetDevLaunchQuitTD();
  49. #    Assumptions:    none
  50. #=============================================================================================
  51. #    History:
  52. #        Date:        By:        Changes:
  53. #        04/12/92    SBR        Created
  54. #        05/27/93    SBR        Changed 'creatorDupe' to 'noCreatorLaunch'
  55. #        05/29/93    SBR        Created this file from AIQ LaunchQuits to make development easier
  56. #        03/01/94    SBR        Rewrote GetDevLaunchQuitTC() for most recent lookup task parameters
  57. #                            Currently it supports ONLY the "nextTD" lookup method.
  58. #        07/30/95    SBR        Converts *all* partialName values (lookup methods) to "nextTD".
  59. #                            GetDevLaunchQuitTC() sets global gDevelopmentMode to true.
  60. #                            GetDevLaunchQuitTC() prints status when a test def is found.
  61. #        01/31/97    SBR        Changed GetDevLaunchQuitTC to GetDevLaunchQuitTD.
  62. ##############################################################################################
  63. task    GetDevLaunchQuitTD(partialName := "nextTD", appParameters := {}, resetTDHistory := false,
  64.                             v_level := 4)
  65. begin
  66.     global gDevTDList, gCardDevTDList, gPreviousTD, gDevelopmentMode;
  67.     
  68.     gDevelopmentMode := true;
  69.     
  70.     partialName := "nextTD";                        # we only do "nextTD"
  71.     
  72.     if isUndefined(gDevTDList) or resetTDHistory
  73.     begin
  74.         gDevTDList := 
  75.         {            
  76.         
  77.             (*Setup: none.*)        
  78.         #    {1,"SampleApp@", "SAMP", "SampleAppƒ", {}, {}, {}    },
  79.             
  80.     {1,"Nisus Writer 4.0@","NISI","Nisus Writer 4.0ƒ",{'SNConflict'},
  81.     {{[staticText t:/The registration number≈/ w:1],[button t:'OK'],
  82.     [staticText t:'Registration Number:' w:1],{'type_keys',{'6264962766921',returnKey}}},''},
  83.     {[menuItem t:'Quit' m:2 k:'q'],{'key_eq','q'},{[application t:'Nisus Writer 4.0@'],'>'},''} },
  84.                         
  85.             
  86.             {}        ### DO NOT REMOVE THIS TEST DEF; IT MUST BE LAST *AND* EMPTY!!!
  87.     
  88.         };
  89.         
  90.         gPreviousTD := 0;
  91.         gCardDevTDList := card gDevTDList;
  92.     end;
  93.     
  94.     if partialName = "nextTD"                    # we prefer "nextTD"
  95.     begin
  96.         gPreviousTD := gPreviousTD + 1;
  97.         return gDevTDList[gPreviousTD];
  98.     end;
  99.     else
  100.     begin
  101.         RStatus("GetDevLaunchQuitTD({partialName},{appParameters},{resetTDHistory},{v_level})",v_level);
  102.         return {};
  103.     end;
  104. end;
  105.  
  106.  
  107. # 08/01/95 SBR: UNDER CONSTRUCTION, TRYING TO MAKE DEV LAUNCHQUITS DO "randomDeal" AND "by name"
  108. #                LOOKUPS INSTEAD OF JUST "nextTD"...
  109. #    
  110. #    task GetDevLaunchQuitTD(partialName := "nextTD", appParameters := {}, resetTDHistory := false,
  111. #                                v_level := 4)
  112. #    begin
  113. #        global gDevTDList, gCardDevTDList, gPreviousTD, gDevelopmentMode, gDevLQTDHistory;
  114. #        
  115. #        if resetTDHistory
  116. #        begin
  117. #            if typeOf (resetTDHistory) = "list"
  118. #                gDevLQTDHistory := resetTDHistory;
  119. #            else 
  120. #                gDevLQTDHistory := {{0,0},{}};
  121. #        end;
  122. #        else 
  123. #        begin
  124. #            if not gDevLQTDHistory
  125. #                gDevLQTDHistory := {{0,0},{}};
  126. #        end;
  127. #        
  128. #        theTestDef := { };            #default value in case we can not find a good one
  129. #        
  130. #        if partialName ~= /random≈/
  131. #        begin
  132. #            foundRandomTD := false;
  133. #            # For the first random pick, create a list of all development TD ordinals
  134. #            # Subsequent random picks can remove items from the list for speed
  135. #            if gDevLQTDHistory = {{0,0},{}}
  136. #            begin
  137. #                gDevLQTDHistory := {};
  138. #                for i := 1 to gCardDevTDList                #total number of development test defs
  139. #                    gDevLQTDHistory := gDevLQTDHistory + {i};
  140. #                gDevLQTDHistory := {{0,0},gDevLQTDHistory};
  141. #            end;
  142. #            tdOrdinalsList := gDevLQTDHistory[2];
  143. #            while tdOrdinalsList and not theTestDef
  144. #            begin
  145. #                # search until one is found or there are no more TD ordinals left to pick from
  146. #                
  147. #                randomIndex := random(1, card tdOrdinalsList);
  148. #                randomOrdinal := tdOrdinalsList[randomIndex];
  149. #                
  150. #    #                Used by the original GetLaunchQuitTD, not needed for small dev launchquits list
  151. #    #                lookupTaskIndex := 2;
  152. #    #                while randomOrdinal >= tdOrdinalSumList[lookupTaskIndex]
  153. #    #                    lookupTaskIndex := lookupTaskIndex + 1;
  154. #    #                lookupTaskIndex := lookupTaskIndex - 1;
  155. #    #                theLookupTask := lookupTaskList[lookupTaskIndex][2];
  156. #    #                tdOrdInLookupTask := 1 + randomOrdinal - tdOrdinalSumList[lookupTaskIndex];
  157. #    #                lookupValue := call (theLookupTask, "thisTD", tdOrdInLookupTask, appParameters);
  158. #    
  159. #                                ScanDevLaunchQuitTDList(TDIndexList, partialName, previousIndex, appParameters)
  160. #                lookupValue := call (theLookupTask, "thisTD", randomOrdinal, appParameters);
  161. #                if lookupValue
  162. #                begin
  163. #                    theTestDef := lookupValue[2];        #ignore lookup index returned in [1]
  164. #                    if partialName = "randomDeal"
  165. #                    begin
  166. #                        tdOrdinalsList := remove(randomIndex, tdOrdinalsList);
  167. #                    end;
  168. #                end;
  169. #                else 
  170. #                    tdOrdinalsList := remove(randomIndex, tdOrdinalsList);
  171. #            end;
  172. #            if theTestDef
  173. #                gDevLQTDHistory := {{ lookupTaskIndex,tdOrdInLookupTask },tdOrdinalsList };
  174. #            else 
  175. #                gDevLQTDHistory := {};        #reset to insure initialization next time
  176. #            return theTestDef;
  177. #        end;    # random
  178. #    
  179. #        previousIndexes := gDevLQTDHistory[1];
  180. #        stopIndex := card lookupTaskList;
  181. #        if partialName = "nextTD" or partialName = "thisTD" or previousIndexes <> {0,0}
  182. #        begin
  183. #            startIndex := previousIndexes[1];
  184. #            if not startIndex
  185. #                startIndex := startIndex + 1;
  186. #        end;
  187. #        else if partialName[1] ~= /[∂≈∂?]/        # first character unknown, start search at first TD
  188. #            startIndex := 1;
  189. #        else 
  190. #        begin                                # first character known, use top level assoc
  191. #            theLookupTask := assoc ( partialName[1], lookupTaskList );
  192. #            if theLookupTask
  193. #            begin
  194. #                startIndex := isMember({ partialName[1],theLookupTask },lookupTaskList);
  195. #                stopIndex := startIndex;
  196. #            end;
  197. #            else 
  198. #                startIndex := stopIndex + 1;
  199. #        end;
  200. #            
  201. #        for currentIndex := startIndex to stopIndex
  202. #        begin
  203. #            theLookupTask := lookupTaskList[currentIndex][2];
  204. #            lookupValue := call (theLookupTask, partialName, previousIndexes[2], appParameters);
  205. #            
  206. #            if lookupValue
  207. #            begin
  208. #                previousIndexes := { currentIndex,lookupValue[1] };
  209. #                theTestDef := lookupValue[2];
  210. #                stopIndex := 0;
  211. #            end;
  212. #            else 
  213. #                previousIndexes := {0,0};
  214. #        end;
  215. #        if theTestDef
  216. #            gDevLQTDHistory := { previousIndexes,gDevLQTDHistory[2] };
  217. #        else 
  218. #            gDevLQTDHistory := {};        #reset to insure initialization next time
  219. #        return theTestDef;
  220. #    end;
  221. #    
  222. #    ##############################################################################################
  223. #    #    task ScanDevLaunchQuitTDList(TDIndexList, partialName, previousIndex, appParameters)
  224. #    #=============================================================================================
  225. #    #    Description:    Extracts a test def using a list of test def indexes and conditions
  226. #    #                    Usually only called by get_LaunchQuits_a where a is the first letter
  227. #    #                    of the name of the test def. Used in three basic ways:
  228. #    #                    exact name:     Put the full name into partialName (including "@").
  229. #    #                                    This method is the fastest, it uses assoc() built-in task.
  230. #    #                    partial name:     Put the partial name into partialName. Put "≈" in the
  231. #    #                                    first character to find things in the middle of the name.
  232. #    #                                    Slower than exact name.
  233. #    #                    this test def:    Put "thisTD" into partialName and fill previousIndex with
  234. #    #                                    the value scanLaunchQuitTDList returned from the previous
  235. #    #                                    successful find. It returns the current TD.
  236. #    #                    next test def:    Put "nextTD" into partialName and fill previousIndex with
  237. #    #                                    the value scanLaunchQuitTDList returned from the previous
  238. #    #                                    successful find. It returns the next TD alphabetically.
  239. #    #    Parameters:        partialName:     string value; see above for use 
  240. #    #                    previousIndex:     provides context for the "nextTD" case; use returnIndex
  241. #    #                                    value from the previous find, or zero to get the first
  242. #    #                                    test def in the list
  243. #    #                    appParameters:     return only test defs with these values in theParams (not
  244. #    #                                    valid for exact name method). Ignored if empty.
  245. #    #                    TDIndexList:     associate list; name is index and testDefTask is value
  246. #    #                                    Created by get_LaunchQuits_x tasks, called by GetLaunchQuitTD
  247. #    #                    
  248. #    #    Returns:        successful find: { returnIndex,theTestDef }
  249. #    #                    unsuccessful find: { }
  250. #    #    Examples:        scanLaunchQuitTDList("nextTD", prevRtnVal[1], TDIndexList)    #standard "next"
  251. #    #                    scanLaunchQuitTDList("TeachText 7.0@", TDIndexList)            #Fast Exact Name
  252. #    #                    scanLaunchQuitTDList("AppleLink", TDIndexList)                #Partial Name
  253. #    #                    scanLaunchQuitTDList("≈Link", TDIndexList)                    #Partial Name
  254. #    #                    scanLaunchQuitTDList("nextTD",,{"FPU"}, TDIndexList)        #First FPU-only app
  255. #    #    Assumptions:    enough memory to hold it
  256. #    #=============================================================================================
  257. #    #    History:
  258. #    #        Date:        By:        Changes:
  259. #    #        08/12/93    SBR        Created
  260. #    ##############################################################################################
  261. #    task ScanDevLaunchQuitTDList(partialName := "nextTD", previousIndex := 0, appParameters := {},
  262. #                                TDIndexList := {})
  263. #    begin
  264. #        returnIndex := 0;
  265. #        theTestDef := {};
  266. #        TDIndexQty := card TDIndexList;
  267. #        launchParametersIndex := 5;                            # e.g. {"FPU"} or {"SNConflict"}
  268. #        
  269. #        if partialName[card partialName] = "@"                    # exact match is faster
  270. #        begin
  271. #            testDefTask := assoc(partialName, TDIndexList);
  272. #            if testDefTask
  273. #            begin
  274. #                returnIndex := isMember({partialName,testDefTask},TDIndexList);
  275. #                theTestDef := call(testDefTask);
  276. #                fullName := partialName;
  277. #            end;
  278. #        end;
  279. #        else begin
  280. #            if partialName = "nextTD"
  281. #            begin
  282. #                previousIndex := previousIndex + 1;
  283. #                partialNameScan := false;
  284. #            end;
  285. #            else if partialName = "thisTD"
  286. #            begin
  287. #                partialNameScan := false;
  288. #                TDIndexQty := previousIndex;
  289. #            end;
  290. #            else 
  291. #                partialNameScan := true;
  292. #                
  293. #            for currentIndex := previousIndex to TDIndexQty
  294. #            begin
  295. #                fullName := TDIndexList[currentIndex][1];
  296. #                
  297. #                if partialNameScan
  298. #                    nameOK := fullName ~= /{partialName}≈/;
  299. #                else 
  300. #                    nameOK := true;
  301. #        
  302. #                if nameOK
  303. #                begin
  304. #                    testDefTask := assoc(fullName, TDIndexList);
  305. #                    theTestDef := call(testDefTask);
  306. #        
  307. #                    if appParameters
  308. #                    begin
  309. #                        launchParameters := theTestDef[launchParametersIndex];
  310. #                        
  311. #                        appParametersOK := 1;
  312. #                        for each appParameter in appParameters
  313. #                            appParametersOK := appParametersOK * isMember(appParameter,launchParameters);
  314. #                        
  315. #                        if not appParametersOK
  316. #                            theTestDef := {};
  317. #                    end;
  318. #                end;
  319. #                
  320. #                if theTestDef
  321. #                begin
  322. #                    returnIndex := currentIndex;
  323. #                    TDIndexQty := 0;
  324. #                end;
  325. #            end;
  326. #        end;
  327. #        
  328. #        if theTestDef
  329. #            return { returnIndex,theTestDef };
  330. #        else 
  331. #            return { };
  332. #    end;
  333.  
  334.  
  335.